package com.example.test1024;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ListTest extends AppCompatActivity {
    private ListView listView ;

String fruits[] ={"苹果"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list_test);
        initView();
    }

    private void initView() {

        listView=findViewById(R.id.listView);
        ArrayAdapter<String> adapter=new ArrayAdapter<String>(ListTest.this,
                android.R.layout.simple_list_item_1,fruits);
        listView.setAdapter(adapter);


    }
}